<template>
   <div class="sorting" @click="sortingClick">
        <span>
            按相似度排
        </span>
        <span>
            发布时间
            <i></i>
        </span>
        <span>
            浏览量
            <i></i>
        </span>
    </div>
</template>

<script>
export default {
  methods: {
    sortingClick: function (event) {
      var sorting = document.getElementsByClassName('sorting')[0]
      var spans = sorting.getElementsByTagName('span')    
      if (event.target.className.indexOf('sortingClick') === -1) {
          if (event.target.nodeName === 'SPAN') {
            for (var i = 0; i < spans.length; i++) {
              spans[i].className = ''
            }
            event.target.className = 'sortingClick'
          }
      }
    }
  }
}
</script>

<style>
    @import '../../../static/components/public/sorting.css'
</style>
